package tech.xs.service.Impl;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;


import tech.xs.dao.UserDao;
import tech.xs.entity.User;
import tech.xs.service.UserService;

/** 
* @author 作者 Your-Name:席盛 
* @version 创建时间：2020年2月13日 下午4:41:13 
* @类说明
*/
@Service
public class UserServiceImpl implements UserService {
	
	@Resource
	private UserDao userDao;
	
	@Override
	public User login(String userCode, String userPassword) {
			return userDao.getLoginUser(userCode, userPassword);	
	}

	@Override
	public List<User> getUserList(String userName, int userRole, int currentPageNo, int pageSize) {
		return userDao.getUserList(userName, userRole, currentPageNo, pageSize);
	}

	@Override
	public int getUserCount(String userName, int userRole) {
		// TODO Auto-generated method stub
		return userDao.getUserCount(userName, userRole);
	}

	@Override
	public boolean add(User user) {
		if (userDao.add(user)>0) {
			return true;
		}else {
			return false;
		}
	}

	@Override
	public User getUserById(Integer id) {
		// TODO Auto-generated method stub
		return userDao.getUserById(id);
	}

	@Override
	public boolean modify(User user) {
		if (userDao.modify(user)>0) {
			return true;
		}else {
			return false;
		}
	}

	@Override
	public boolean deleteUserById(Integer delId) {
		if (userDao.deleteUserById(delId)>0) {
			return true;
		}else {
			return false;
		}
	}

	@Override
	public User getUserCode(String userCode) {
		return userDao.getUserCode(userCode);
	}

}
